﻿using System;
using System.IO;
using System.Net;
using Accona.Monitoring.AppStatistics;
using Accona.Monitoring.Exposure.REST;
using Accona.Monitoring.Publishers;

namespace Accona.Monitoring.Example
{
    public class Class1
    {
        public static void Main(string[] args)
        {
            var value = 100;

            Monitor.Setup()
            .WithPublisher<MemoryPublisher>()
            .WithExposure(new RestExposure(8080))
            .Schedule(2000)
            .AddScheduledJob(() => Monitor.Publish(new DefaultAppStatistics()
                                                        {
                                                            AppName = "Test",
                                                            StatNamespace = "Monitor.Test",
                                                            Tag = "SomeTag",
                                                            Value = value++
                                                        }));



            //WebClient client = new WebClient();
            //var stream = client.OpenRead("http://localhost:8080/Stats/Test");
            //var reader = new StreamReader(stream);
            //reader.ReadToEnd();
            //Console.WriteLine(reader);

            Console.ReadLine();
        }
    }
}
